package com.xand.jsonrpc.test.server;

import com.xand.jsonrpc.JSONGenericResponse;
import com.xand.jsonrpc.client.JSONRPCClient;
import com.xand.jsonrpc.test.TestClassRequest;
import com.xand.jsonrpc.test.TestClassResponse;

public class ClientLauncher {
	public static void main(String[] args) throws Exception {
		TestClassRequest req = new TestClassRequest();
		req.setServiceId("myTestService01");
		
		// JSONSerializer ser = new JSONSerializer("dskfjklsjflksdjfldksjflkdsjklsdfjdslkjf");
		
		JSONRPCClient client = new JSONRPCClient("http://localhost:8080/");
		JSONGenericResponse response = client.invoke(req, TestClassResponse.class);
		
		System.out.println("Short: " + response.getShortErrorMessage());
		System.out.println("Long: " + response.getLongErrorMessage());
		System.out.println("Code: " + response.getResponseCode());
		
		TestClassResponse tcr = (TestClassResponse)response.getResponse(TestClassResponse.class);
		
		System.out.println(tcr.toString());
	}
}
